package com.delivery.common;


import com.delivery.utils.StringUtils;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;

public class MyProgressHandler extends Handler {
		
		private static ProgressDialog pDialog = null;
		
		private Context mContext;
		
		public MyProgressHandler() {
		}
		
		public MyProgressHandler(Context conn,int a) {
			mContext = conn;
		}
	
		public MyProgressHandler(Looper L) {
			super(L);
		}
	
		@Override
		public void handleMessage(Message msg) {
			Bundle b = msg.getData();
			String rmsg = b.getString("rmsg");
			if(StringUtils.isNotEmpty(rmsg) && rmsg.equals("0")){
				pDialog = new ProgressDialog(mContext);
				//pDialog.setTitle("请稍等...");  
				pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);  
				pDialog.setMessage("正在加载数据...");  
				//pDialog.setIcon(R.drawable.icon);  
		        //进度条是否不明确   
				pDialog.setIndeterminate(true);  
				pDialog.setCancelable(true);  
				pDialog.show();
			}else if(rmsg.equals("1")){
				pDialog.cancel();
			}else if(rmsg.equals("2")){
				pDialog.show();
			}
		}
}
